package cc.bookcloud.tool.ocr.common.parsetext;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @Desc: @todo
 * @Version: 2.0
 * @Author: John Goo
 * @Date: 2024/11/25 17:18
 **/
public class InvoiceParseTemplate {

    public InvoiceParseTemplate(){
        init();
    }


    private List<ParseMeta> list;

    public ParseMeta parseText(String text,int pos){

        // 遍历特征函数
        for(int i=0; i<list.size(); i++){
            ParseMeta parseMeta = list.get(i);

            if(true){
                break;
            }
        }

        return null;

    }


    /**
     * @Desc：初始化模板
    * @Author：John Goo
    * @Date：2024/11/25 17:31

    * @return void
    */
    private void init(){
        list = new ArrayList<>();
        list.add(new ParseMeta("ticket_number","","火车票红色编码","{}","1,2"));
        list.add(new ParseMeta("departure_date","","乘车时间","{}","1,2"));
        list.add(new ParseMeta("seat_number","","座位号","{}","1,2"));
        list.add(new ParseMeta("class","","座位类别","{}","1,2"));
        list.add(new ParseMeta("departure_station","","出发地","{}","1,2"));
        list.add(new ParseMeta("train_number","","车次号","{}","1,2"));
        list.add(new ParseMeta("arrival_station","","目的地","{}","1,2"));
        list.add(new ParseMeta("price","","价格","{}","1,2"));
        list.add(new ParseMeta("check","","检票口","{}","1,2"));
        list.add(new ParseMeta("passenger_id","","乘客身份证号","{}","1,2"));
        list.add(new ParseMeta("passenger_name","","乘客名称","{}","1,2"));
        list.add(new ParseMeta("ticket_id","","火车票ID","{}","1,2"));

    }

    public List getTempList(){
        return list;
    }

    public static void main(String[] args) {
        InvoiceParseTemplate template = new InvoiceParseTemplate();
        //template.parse("ok");
        System.out.println(JSON.toJSONString(template.getTempList()));
    }

    @Data
    public static class ParseMeta{
        // 字段
        private String key;
        // 内容
        private String value;
        // 描述
        private String describe;
        // 规则
        private String rule;
        // 位置
        private String pos;

        public ParseMeta(String key, String value, String describe, String rule, String pos) {
            this.key = key;
            this.value = value;
            this.describe = describe;
            this.rule = rule;
            this.pos = pos;
        }


    }


}


